from typing import List

input = [1,1,2]

def permutation(nums):
    res = []
    path = []

    nums.sort()
    _permutation(nums, res, path)

    return res

def _permutation(nums: List[int], res, path):
    if not nums:
        res.append(path.copy())
        return
    for i, num in enumerate(nums):
        # dup num, done before
        if i and num == nums[i-1]:
            continue
        left = nums.copy()
        left.remove(num)
        path.append(num)
        _permutation(left, res, path)
        path.pop()

print(permutation(input))